package util;

import java.sql.*;

public class BaseDao {
    public Connection getConn(){
        Connection connection = null ;
        //1.
        try {
            Class.forName("com.mysql.jdbc.Driver") ;
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/boostrap","root","root") ;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return connection ;
    }

    public  void closeAll(ResultSet resultSet, Statement statement,Connection connection)
    {
        if(resultSet!=null){
            try {
                resultSet.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if(statement!=null){
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if(connection!=null){
            try {
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
